package QuestionNum_15_4;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        String strNeed = "";
        System.out.println("请输入字符串");
        Scanner sc = new Scanner(System.in);
        String st = sc.next();
        while(true){
            if (st.equals("end")){
                break;
            }
            strNeed += st;
            System.out.println("请继续输入字符");
            st = sc.next();
        }
        System.out.println(strNeed);
        convert(strNeed);
    }
    public static void convert(String str){
        char[] c = str.toCharArray();
        int count = 0;
        for (int i=0;i<c.length;i++){
            if (c[i] >= 'A' && c[i] <= 'Z'){
                c[i] = (char)(c[i] + 32);
                count++;
            }else if (c[i] >= 'a' && c[i] <= 'z'){
                c[i] = (char)(c[i] - 32);
                count++;
            }else {
                c[i] = '*';
            }
        }
        System.out.println("字母个数有:"+count+"个");
        for (int i=0;i<c.length;i++){
          System.out.print(c[i]);
        }
    }
}
